home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume25 / npasswd / part01 next >
Encoding:
Text File  |  1991-12-19  |  60.3 KB  |  1,854 lines

  1. Newsgroups: comp.sources.unix
  2. From: clyde@emx.utexas.edu (Clyde Hoover)
  3. Subject: v25i074: npasswd - replacement for passwd(1), Part01/03
  4. Sender: sources-moderator@pa.dec.com
  5. Approved: vixie@pa.dec.com
  6.  
  7. Submitted-By: clyde@emx.utexas.edu (Clyde Hoover)
  8. Posting-Number: Volume 25, Issue 74
  9. Archive-Name: npasswd/part01
  10.  
  11. Npasswd is a pretty-much-plug-compatable replacement for passwd(1).  This
  12. version incorporates a password checking system that disallows simple-minded
  13. passwords.
  14.  
  15. It does exactly ONE thing - change login passwords, though it would not be
  16. too difficult to make it do shells and GECOS stuff also.
  17.  
  18. I have modeled npasswd after passwd(1) from 4.3BSD and SunOS 4.0, but it
  19. does not impliment the options those versions have.  I have also included
  20. support for Sys VR3 password aging.
  21.  
  22. This version runs at our site under SunOS 4.X, Ultrix 4.0, UMAX 4.3 and
  23. MORE/BSD.
  24.  
  25. It is also available via anonymous FTP from emx.utexas.edu in the directory
  26. pub/npasswd.
  27.  
  28.     clyde@emx.utexas.edu
  29.     -Clyde Hoover
  30.  
  31. #! /bin/sh
  32. # This is a shell archive.  Remove anything before this line, then unpack
  33. # it by saving it into a file and typing "sh file".  To overwrite existing
  34. # files, type "sh file -c".  You can also feed this as standard input via
  35. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  36. # will see the following message at the end:
  37. #        "End of archive 1 (of 3)."
  38. # Contents:  MANIFEST README checkpasswd/Makefile
  39. #   checkpasswd/call_ckpasswd.c checkpasswd/checkpasswd.3
  40. #   checkpasswd/checkpasswd.c checkpasswd/checkpasswd.cf
  41. #   checkpasswd/checkpasswd.h checkpasswd/dict/Makefile
  42. #   checkpasswd/dict/README checkpasswd/dict/makedict.8
  43. #   checkpasswd/dict/makedict.c checkpasswd/dict/viewdict.8
  44. #   checkpasswd/dict/viewdict.c checkpasswd/libmain.c
  45. #   checkpasswd/main.c checkpasswd/pwck_local.c
  46. #   checkpasswd/pwck_passwd.c checkpasswd/version.h npasswd.1
  47. #   npasswd.conf npasswd.help npasswd.motd npasswd.shar version.h
  48. # Wrapped by clyde@tigger.cc.utexas.edu on Fri Jan 25 10:35:05 1991
  49. for f in checkpasswd checkpasswd/dict; do
  50.     mkdir $f
  51. done
  52. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  53. if test -f 'MANIFEST' -a "${1}" != "-c" ; then 
  54.   echo shar: Will not clobber existing file \"'MANIFEST'\"
  55. else
  56. echo shar: Extracting \"'MANIFEST'\" \(1213 characters\)
  57. sed "s/^X//" >'MANIFEST' <<'END_OF_FILE'
  58. XMANIFEST        This file
  59. XREADME            Do so
  60. XCHANGE.LOG        Change descriptions from SCCS files
  61. XMakefile.dist        q.e.d.
  62. Xversion.h        Version information
  63. Xnpasswd.c        Main program
  64. Xnpasswd.help        Help file
  65. Xnpasswd.conf        Sample config file (same as checkpasswd.cf)
  66. Xnpasswd.motd        Sample message file
  67. Xpw_passwd.c        Standard password file updater
  68. Xpw_yp.c            Yellow Pages (NIS) updater
  69. Xpw_userinfo.c        UTCC 'userinfo' updater
  70. Xnpasswd.1        Manual page boilerplate
  71. X
  72. Xcheckpasswd/README        Readme file for password checker
  73. Xcheckpasswd/Makefile        Makefile for password checker
  74. Xcheckpasswd/checkpasswd.8    Man page for password checker
  75. Xcheckpasswd/checkpasswd.3    Man page for library version
  76. Xcheckpasswd/checkpasswd.h    Include file
  77. Xcheckpasswd/checkpasswd.cf    Sample configuration file
  78. Xcheckpasswd/checkpasswd.c    Driver for password checker
  79. Xcheckpasswd/libmain.c        Library glue main
  80. Xcheckpasswd/main.c        Standalone program main
  81. Xcheckpasswd/pwck_dict.c
  82. Xcheckpasswd/pwck_lexical.c
  83. Xcheckpasswd/pwck_local.c
  84. Xcheckpasswd/pwck_passwd.c
  85. Xcheckpasswd/util.c
  86. Xcheckpasswd/version.h
  87. Xcheckpasswd/call_ckpasswd.c
  88. X
  89. Xcheckpasswd/dict/README
  90. Xcheckpasswd/dict/Makefile
  91. Xcheckpasswd/dict/makedict.8
  92. Xcheckpasswd/dict/makedict.c
  93. Xcheckpasswd/dict/viewdict.8
  94. Xcheckpasswd/dict/viewdict.c
  95. END_OF_FILE
  96. if test 1213 -ne `wc -c <'MANIFEST'`; then
  97.     echo shar: \"'MANIFEST'\" unpacked with wrong size!
  98. fi
  99. # end of 'MANIFEST'
  100. fi
  101. if test -f 'README' -a "${1}" != "-c" ; then 
  102.   echo shar: Will not clobber existing file \"'README'\"
  103. else
  104. echo shar: Extracting \"'README'\" \(4825 characters\)
  105. sed "s/^X//" >'README' <<'END_OF_FILE'
  106. XREADME for npasswd March 1990
  107. X
  108. X@(#)README    1.6 3/19/90 (cc.utexas.edu)
  109. X
  110. X* Introduction
  111. X
  112. XNpasswd is a pretty-much-plug-compatable replacement for passwd(1).
  113. XThis version incorporates a password checking system
  114. Xthat disallows simple-minded passwords.
  115. X
  116. XIt does exactly ONE thing - change login passwords, though it would
  117. Xnot be too difficult to make it do shells and GECOS stuff also.
  118. X
  119. XI have modeled npasswd after passwd(1) from 4.3BSD and SunOS 4.0, but
  120. Xit does not impliment the options those versions have.
  121. XI have also included support for Sys VR3 password aging, but I don't have
  122. Xa SysV box around to test it on.
  123. X
  124. X* About npasswd
  125. X
  126. XThe program is divided into upper and lower sections.
  127. XThe upper (driver) half deals with abstract data such as login names and
  128. Xpasswords.  It has no knowledge of how or where passwords are stored.
  129. X
  130. XThe lower (method) half does data lookup and replacement.  There are 
  131. Xtwo different method modules provided with this distribution.
  132. X
  133. X    pw_passwd.c - deals with standard /etc/passwd type files and
  134. X        the hashed passwd database used in 4.3BSD.
  135. X    pw_yp.c - deals with standard /etc/passwd files and Yellow Pages
  136. X        passwd service.
  137. X
  138. XThe lower half hides all its data from the upper half, and vice versa.
  139. XThe upper and lower halves communicate via this interface:
  140. X
  141. X    pw_initalize()        Do initializations 
  142. X    pw_getuserbyname()    Get user information by name
  143. X    pw_permission()        Check if user has permission
  144. X                 to change this users' password
  145. X    pw_compare()        Compare passwords (returns 1 on match, 0 if not)
  146. X    pw_check()        Check password (returns 1 if ok, 0 otherwise)
  147. X    pw_replace()        Replace the password
  148. X    pw_cleanup()        Cleanup
  149. X
  150. XBoth the upper and lower halves keep private state, and must determine
  151. Xsuch things as who invoked the program seperately.
  152. X
  153. XThis approach allows there to be one user interface for a variety of
  154. Xpassword storage methods.  To support another method, such as shadow
  155. Xpassword files, a new collection of method routines need be written and
  156. Xlinked to npasswd.o.
  157. X
  158. XI have tried to minimalize the assumptions about what is available in the
  159. XC library and localized UNIX version dependancies.
  160. X
  161. X* Building npasswd
  162. X
  163. X- You will probably want to edit the manual page - it is fairly rough.
  164. X
  165. X- Look at the sources before you install to see if the assumptions
  166. X  I made are correct for your site.
  167. X
  168. X1. Choose which version of npasswd you want to be the default and
  169. X   retarget 'all' in Makefile to point to it.
  170. X
  171. X2. Read checkpasswd/README and configure Makefiles accordingly.
  172. X
  173. X3. Set the system target information in Makefile.
  174. X    * For running under SunOS 4.X system, set OPTIONS = -DSUNOS4 
  175. X    * If you are thinking about running Sun "Secure RPC", add
  176. X      -DSECURE_RPC to OPTIONS
  177. X    * For running under System V, set OPTIONS = -DSYSV
  178. X    * To use syslog(3), include -DSYSLOG in OPTIONS
  179. X    * To update the 4.3BSD hashed password database,
  180. X      include '-DBSD4_3' in OPTIONS.
  181. X    * Change the lines for 'CF' and 'HF' to retarget the config and
  182. X      or help files.
  183. X
  184. X4. Edit 'npasswd.help' to reflect the preferences chosen for the
  185. X   password checking plus add any other local administrativa.
  186. X
  187. X5. Edit 'npasswd.conf' to reflect your preferences.  See
  188. X   checkpasswd/checkpasswd.8 (or the section below) for information about
  189. X   the password checking configuration file.
  190. X
  191. X6. Do a 'make'.
  192. X
  193. X7. Become super-user and do 'make install'.
  194. X
  195. X8. If you built npasswd with -DSYSLOG, modify /etc/syslog.conf to log
  196. X   messages for facility LOG_AUTH level LOG_INFO.  This gives you a record
  197. X   of password changes.
  198. X
  199. X* The configuration file explained
  200. X
  201. Xdictionary    /path/to/dictionary    [description]
  202. X    /usr/dict/words is always looked in.
  203. X    There are 2 good reasons to have a DBM version of each dictionary:
  204. X    1. Faster password checking.    
  205. X    2. More secure checking.  If there are no DBM files, then egrep(1)
  206. X       is used and unfortunately, the candidate password must be put on the 
  207. X       command line - which makes it suspectible to being seen with ps(1).
  208. X
  209. X# singlecase    yes | [no]    - Pass single-case passwords
  210. X    Allow single case passwords.  Default is not to.
  211. X
  212. X# minlength    N [5]    - Minimum password length
  213. X    5 characters is the default minimum password length
  214. X
  215. X# maxlength    N [8]    Maximum effective password length
  216. X    All this does is issue a warning message that just the first N
  217. X    characters of a password are used.
  218. X
  219. X# printonly    yes | [no]     - Allow only printable characters
  220. X    Allow non-printable (ASCII control) characters in passwords
  221. X
  222. X# badchars    "<string>"    - Replace illegal character list
  223. X    Set a list of characters verboten in passwords.
  224. X    This form REPLACES the built-in illegal character list.
  225. X    Control characters may be specified by the '^X' convention.  
  226. X
  227. X# badchars    +"<string>"    - Add to illegal character list
  228. X    Adds to the built-in illegal character list.
  229. X
  230. X----------------------
  231. XBug reports & enhancements to
  232. Xclyde@emx.utexas.edu
  233. X
  234. X
  235. X    -Clyde Hoover
  236. X
  237. END_OF_FILE
  238. if test 4825 -ne `wc -c <'README'`; then
  239.     echo shar: \"'README'\" unpacked with wrong size!
  240. fi
  241. # end of 'README'
  242. fi
  243. if test -f 'checkpasswd/Makefile' -a "${1}" != "-c" ; then 
  244.   echo shar: Will not clobber existing file \"'checkpasswd/Makefile'\"
  245. else
  246. echo shar: Extracting \"'checkpasswd/Makefile'\" \(2971 characters\)
  247. sed "s/^X//" >'checkpasswd/Makefile' <<'END_OF_FILE'
  248. X
  249. X# --------------------------------------------------------------------  #
  250. X#                                                                       #
  251. X#                         Author: Clyde Hoover                          #
  252. X#                          Computation Center                           #
  253. X#                   The University of Texas at Austin                   #
  254. X#                          Austin, Texas 78712                          #
  255. X#                         clyde@emx.utexas.edu                          #
  256. X#                   uunet!cs.utexas.edu!ut-emx!clyde                    #
  257. X#                                                                       #
  258. X#This code may be distributed freely, provided this notice is retained. #
  259. X#                                                                       #
  260. X# --------------------------------------------------------------------  #
  261. X#
  262. X#    Makefile for checkpasswd (application & library)
  263. X#
  264. X#    @(#)Makefile    1.2 10/30/89 (cc.utexas.edu)
  265. X#
  266. XBINDIR    = /usr/local
  267. XADMDIR    = /usr/adm
  268. XDIR    = .
  269. X
  270. XAPPNAME    = checkpasswd
  271. XLIBNAME = checkpasswd.a
  272. X
  273. XDEBUG    = -g -DDEBUG
  274. X# Set the following two lines to $(DEBUG) for debugging
  275. XCFLAGS    = -O
  276. XLDFLAGS    = 
  277. XSUBDIRS    = dict
  278. X
  279. X# If building with NDBM, use these lines 
  280. XZLIB    =
  281. XDBM    = -DNDBM
  282. X
  283. XSOURCES = checkpasswd.h checkpasswd.c main.c pwck_dict.c pwck_passwd.c \
  284. X    pwck_lexical.c pwck_local.c util.c checkpasswd.h 
  285. X
  286. XOBJECTS = checkpasswd.o pwck_dict.o pwck_passwd.o pwck_lexical.o \
  287. X    pwck_local.o util.o
  288. X
  289. XAPPMAIN = main.o
  290. XLIBMAIN    = libmain.o
  291. X
  292. Xall:    $(APPNAME) $(LIBNAME) dict
  293. X
  294. X$(APPNAME): $(APPMAIN) $(OBJECTS)
  295. X    cc -o $(APPNAME) $(LDFLAGS) main.o $(OBJECTS)
  296. X
  297. X$(LIBNAME):     $(LIBMAIN) $(OBJECTS)
  298. X    -rm -f $(LIBNAME)
  299. X    ar cr $(LIBNAME) $(LIBMAIN) $(OBJECTS)
  300. X    ranlib $(LIBNAME)
  301. X
  302. X#
  303. X# If not using NDBM from libc, link in $(ZLIB) here
  304. X#
  305. Xpwck_dict.o: pwck_dict.c checkpasswd.h $(ZLIB)
  306. X    $(CC) $(CFLAGS) $(DBM) -c pwck_dict.c
  307. X    -@if [ -n "$(ZLIB)" ]; then\
  308. X        set -x;\
  309. X        $(LD) -r $*.o -o $*.x $(ZLIB);\
  310. X        mv $*.x $*.o;\
  311. X    fi
  312. X    @echo Build programs in subdir \'dict\' with \"$(DBM)\"
  313. X
  314. X#
  315. X# Local library linked to this module to simplify rest of make procedure
  316. X# (UTEXAS CC only). 
  317. X#
  318. XUILIB    = /usr/local/lib/libuserinfo.a
  319. Xpwck_passwd.o: pwck_passwd.c checkpasswd.h
  320. X    -@if [ -f $(UILIB) ]; then \
  321. X        set -ex;\
  322. X        $(CC) $(CFLAGS) -DUTEXAS_CC -c $<;\
  323. X        $(LD) -r $*.o -o $*.x $(UILIB);\
  324. X        mv $*.x $*.o;\
  325. X    else \
  326. X        set -x; $(CC) $(CFLAGS) -c $<;\
  327. X    fi
  328. X
  329. Xclean::
  330. X    rm -f *.o a.out checkpasswd core $(LIBNAME)
  331. X    -@for f in $(SUBDIRS); do \
  332. X        (cd $$f; make clean); done
  333. X
  334. Xdict::
  335. X    (cd dict; make $(MFLAGS))
  336. X
  337. Xinstall:    checkpasswd
  338. X    install -s checkpasswd $(BINDIR)
  339. X    install -c -m 0644 checkpasswd.cf $(ADMDIR)
  340. X# ------------------------------------------------------------------
  341. X#
  342. X# Source dependancies
  343. X#
  344. Xcheckpasswd.o: checkpasswd.c checkpasswd.h
  345. Xmain.o: main.c checkpasswd.h version.h
  346. Xlibmain.o: libmain.c checkpasswd.h
  347. Xpwck_lexical.o: pwck_lexical.c checkpasswd.h
  348. Xpwck_local.o: pwck_local.c checkpasswd.h
  349. Xutil.o: util.c checkpasswd.h
  350. END_OF_FILE
  351. if test 2971 -ne `wc -c <'checkpasswd/Makefile'`; then
  352.     echo shar: \"'checkpasswd/Makefile'\" unpacked with wrong size!
  353. fi
  354. # end of 'checkpasswd/Makefile'
  355. fi
  356. if test -f 'checkpasswd/call_ckpasswd.c' -a "${1}" != "-c" ; then 
  357.   echo shar: Will not clobber existing file \"'checkpasswd/call_ckpasswd.c'\"
  358. else
  359. echo shar: Extracting \"'checkpasswd/call_ckpasswd.c'\" \(2518 characters\)
  360. sed "s/^X//" >'checkpasswd/call_ckpasswd.c' <<'END_OF_FILE'
  361. X
  362. X/* --------------------------------------------------------------------  */
  363. X/*                                                                       */
  364. X/*                         Author: Clyde Hoover                          */
  365. X/*                          Computation Center                           */
  366. X/*                   The University of Texas at Austin                   */
  367. X/*                          Austin, Texas 78712                          */
  368. X/*                         clyde@emx.utexas.edu                          */
  369. X/*                   uunet!cs.utexas.edu!ut-emx!clyde                    */
  370. X/*                                                                       */
  371. X/*This code may be distributed freely, provided this notice is retained. */
  372. X/*                                                                       */
  373. X/* --------------------------------------------------------------------  */
  374. X/*
  375. X *    Code which calls the standalone password check program
  376. X */
  377. X#include <sys/types.h>
  378. X#include <sys/wait.h>
  379. X
  380. X#ifndef    CHECKPASSWD
  381. X#define    CHECKPASSWD    "/usr/local/lib/checkpasswd"
  382. X#endif
  383. X/*
  384. X *    checkpasswd - call password checker
  385. X *
  386. X *    Returns: 0 if password can not be used
  387. X *         1 if password can be used
  388. X *        -1 if error
  389. X */
  390. Xcheckpasswd(uid, newpw)
  391. Xint    uid;        /* User id wanting new password */
  392. Xchar    *newpw;        /* Password wanted */
  393. X{
  394. X    int    pid,        /* Child pid */
  395. X        i,        /* Temp */
  396. X        ii,        /* Temp */
  397. X        fds[2];        /* Pipe */
  398. X    union wait    status; /* Child return status */
  399. X    char    pwbuf[128];    /* Password temp buffer */
  400. X
  401. X#ifdef    DEBUG
  402. X    printf("checkpasswd %s\n", newpw);
  403. X#endif
  404. X    (void) sprintf(pwbuf, "%s\n", newpw);
  405. X    if (pipe(fds) < 0) {
  406. X        perror("password_ok pipe");
  407. X        return(-1);
  408. X    }
  409. X    if ((pid = fork()) == 0) {
  410. X        (void) close(0);
  411. X        (void) dup2(fds[0], 0);    /* stdin from pipe */
  412. X        (void) close(fds[0]);
  413. X        (void) close(1);
  414. X        (void) dup2(fds[1], 1);    /* stdin to pipe */
  415. X        (void) close(fds[1]);
  416. X        (void) setgid(getgid());    /* NO-OP if not su */
  417. X        (void) setuid(uid);        /* NO-OP if not su */
  418. X        (void) execl(CHECKPASSWD, "checkpasswd", "-o", 0);
  419. X        exit(-1);
  420. X    }
  421. X    if (pid < 0) {
  422. X        perror("checkpasswd fork");
  423. X        return(-1);
  424. X    }
  425. X    i = write(fds[1], pwbuf, strlen(pwbuf));
  426. X    (void) close(fds[1]);
  427. X    (void) sleep(1);
  428. X    bzero(pwbuf, sizeof(pwbuf));
  429. X    ii = read(fds[0], pwbuf, sizeof(pwbuf));
  430. X    (void) close(fds[0]);
  431. X    while (wait(&status) != pid);
  432. X    if (status.w_retcode == 255 || i <= 0 || ii < 0) {
  433. X        fprintf(stderr, "Checkpasswd error\n");
  434. X        return(-1);
  435. X    }
  436. X    if (status.w_retcode) {
  437. X        printf("%s\n", pwbuf);
  438. X        return(0);
  439. X    }
  440. X    return(1);
  441. X}
  442. END_OF_FILE
  443. if test 2518 -ne `wc -c <'checkpasswd/call_ckpasswd.c'`; then
  444.     echo shar: \"'checkpasswd/call_ckpasswd.c'\" unpacked with wrong size!
  445. fi
  446. # end of 'checkpasswd/call_ckpasswd.c'
  447. fi
  448. if test -f 'checkpasswd/checkpasswd.3' -a "${1}" != "-c" ; then 
  449.   echo shar: Will not clobber existing file \"'checkpasswd/checkpasswd.3'\"
  450. else
  451. echo shar: Extracting \"'checkpasswd/checkpasswd.3'\" \(1730 characters\)
  452. sed "s/^X//" >'checkpasswd/checkpasswd.3' <<'END_OF_FILE'
  453. X'\"
  454. X'\"    @(#)checkpasswd.3    1.1 5/18/89 (cc.utexas.edu)
  455. X'\"
  456. X.TH CHECKPASSWD 3
  457. X.SH NAME
  458. Xcheckpasswd \- check password
  459. X.br
  460. Xsetcheckpasswd \- set parameters for checkpasswd
  461. X.SH SYNOPSIS
  462. X.B int checkpasswd(uid,\ password);
  463. X.br
  464. X.B int\ uid;
  465. X.br
  466. X.B char\ *password;
  467. X.sp
  468. X.B void setcheckpasswd(opt1,\ opt2,\ ...\ optn,\ 0);
  469. X.br
  470. X.B char\ *opt1,\ *opt2,\ ...\ *optn;
  471. X.SH DESCRIPTION
  472. X.I Checkpasswd
  473. Xchecks if
  474. X.B password
  475. Xis suitable for use by the UNIX user with user id
  476. X.BR uid .
  477. X.PP
  478. X.I Checkpasswd
  479. Xreturns 1 if the password is deemed suitable, and 0 otherwise.
  480. XAn informative message is also printed to the standard output
  481. Xif the password does not pass the tests.
  482. X.PP
  483. X.I Setcheckpasswd
  484. Xmay be used to change the operation parameters of 
  485. X.IR checkpasswd .
  486. XIt accepts a list of strings which may be the following:
  487. X.TP
  488. X.B \-\^c
  489. XTake the next argument as the configuration file to read.
  490. XSee the CONFIGURATION section in
  491. X.IR checkpasswd (8)
  492. Xfor information on the configuration file.
  493. X.TP
  494. X.B \-\^e
  495. XReturn the detailed check status instead of 1 or 0.
  496. XSee below for an explanation.
  497. X.TP
  498. X.B \-\^s
  499. XSuppress message output.
  500. X.PP
  501. XThe detailed check status is one of the following:
  502. X.nf
  503. X-1    Password check did not complete.
  504. X0    Password passed all checks.
  505. X1    Password was a null string.
  506. X2    Password was \'too easy\' to guess.
  507. X3    Password was part of the users \'\fIfinger\fP\' information.
  508. X4    Password was found in a dictionary search.
  509. X5    Password contained an illegal character or sequence of characters.
  510. X6    Password was too short.
  511. X.fi
  512. X.SH SEE ALSO
  513. Xmakedict(8), viewdict(8), checkpasswd(8), npasswd(1)
  514. X.SH AUTHOR
  515. XClyde Hoover
  516. X.br
  517. XComputation Center
  518. X.br
  519. XThe University of Texas at Austin
  520. X.br
  521. XAustin, Texas
  522. X.br
  523. Xclyde@emx.utexas.edu, uunet!cs.utexas.edu!ut-emx!clyde
  524. END_OF_FILE
  525. if test 1730 -ne `wc -c <'checkpasswd/checkpasswd.3'`; then
  526.     echo shar: \"'checkpasswd/checkpasswd.3'\" unpacked with wrong size!
  527. fi
  528. # end of 'checkpasswd/checkpasswd.3'
  529. fi
  530. if test -f 'checkpasswd/checkpasswd.c' -a "${1}" != "-c" ; then 
  531.   echo shar: Will not clobber existing file \"'checkpasswd/checkpasswd.c'\"
  532. else
  533. echo shar: Extracting \"'checkpasswd/checkpasswd.c'\" \(3670 characters\)
  534. sed "s/^X//" >'checkpasswd/checkpasswd.c' <<'END_OF_FILE'
  535. X
  536. X/* --------------------------------------------------------------------  */
  537. X/*                                                                       */
  538. X/*                         Author: Clyde Hoover                          */
  539. X/*                          Computation Center                           */
  540. X/*                   The University of Texas at Austin                   */
  541. X/*                          Austin, Texas 78712                          */
  542. X/*                         clyde@emx.utexas.edu                          */
  543. X/*                   uunet!cs.utexas.edu!ut-emx!clyde                    */
  544. X/*                                                                       */
  545. X/*This code may be distributed freely, provided this notice is retained. */
  546. X/*                                                                       */
  547. X/* --------------------------------------------------------------------  */
  548. X/*
  549. X *    checkpasswd.c - Password check driver and data initialization
  550. X */
  551. X
  552. X#ifndef lint
  553. Xstatic char sccsid[] = "@(#)checkpasswd.c    1.1 5/18/89 (cc.utexas.edu)";
  554. X#endif
  555. X
  556. X#include "checkpasswd.h"
  557. X
  558. X/*
  559. X *    Table of password check parameters
  560. X *    May be modified via the configuration file
  561. X */
  562. Xint    single_case =    0,        /* Single-case pwds ok */
  563. X    print_only =    0,        /* Printable ASCII chars only */
  564. X    run_length =    3,        /* How long chars runs can be */
  565. X    min_length =    5,        /* Minimum length */
  566. X    max_length =    8;        /* Maximum effective length */
  567. X
  568. X/*
  569. X *    Control characters best avoided - commonly-used terminal controls.
  570. X *    Add characters here or replace entire contents via the
  571. X *    configuration file.
  572. X */
  573. X#define    ctrl(d)    ('d' & 037)
  574. X
  575. Xchar    illegalcc[sizeof_illegalcc] = {
  576. X    ctrl(c),    /* Interrupt character */
  577. X    ctrl(d),    /* UNIX end-of-file */
  578. X    ctrl(h),    /* Backspace */
  579. X/*     ctrl(i), */
  580. X    ctrl(j),    /* Newline */
  581. X    ctrl(m),    /* Carriage return */
  582. X    ctrl(o),    /* Flush output */
  583. X    ctrl(r),    /* Retype pending input */
  584. X    ctrl(s),    /* Suspend output */
  585. X    ctrl(q),    /* Resume output */
  586. X    ctrl(y),    /* Suspend program deferred */
  587. X    ctrl(z),    /* Suspend program immediate */
  588. X    ctrl(\\),    /* Quit signal */
  589. X    ctrl([),    /* escape - may do strange things to ttys if echoed */
  590. X    ctrl(]),    /* UNIX telnet escape */
  591. X    '\0177',    /* rubout */
  592. X    0
  593. X};
  594. X
  595. X/*
  596. X *    The 'pwck_*' routines all use the PWCK_* return
  597. X *    codes, which are then propigated up to the caller of checkpassword().
  598. X *
  599. X *    All pwck_* routines in the table below are called thusly:
  600. X *        pwck_*(password, userid, mesg)
  601. X *            password = plaintext password string to test.
  602. X *            userid = the user id which wants to use <password>.
  603. X *            mesg = buffer to place long explanation into
  604. X *
  605. X *    If more checks are desired, add the functions to the tables below.
  606. X */
  607. Xextern int
  608. X    pwck_lexical(),
  609. X    pwck_local(),
  610. X    pwck_passwd(),
  611. X    pwck_dictionary();
  612. X
  613. Xtypedef    int    (*function)();
  614. X
  615. Xfunction checkprocs[] = {
  616. X    pwck_lexical,
  617. X    pwck_local,
  618. X    pwck_passwd,
  619. X    pwck_dictionary,
  620. X    0
  621. X};
  622. X
  623. X/*
  624. X *    checkpassword - Password candidate sanity checker.
  625. X *
  626. X *    Arguments;
  627. X *        password = plain text password string to check.
  628. X *        userid = the uid whom the password is for, -1 to disable.
  629. X *
  630. X *    Returns:
  631. X *        PWCK_* values (see checkpasswd.h)
  632. X */
  633. Xcheckpassword(password, userid, mesg)
  634. Xchar    *password;        /* Plaintext of password to check */
  635. Xint    userid;            /* The user this is for */
  636. Xchar    *mesg;            /* Where to stash explanation message */
  637. X{
  638. X    int        rcode;        /* General purpose scratch */
  639. X    function    *checkfunc;    /* Check function pointer */
  640. X
  641. X    if (password == 0 || *password == 0)
  642. X        return(PWCK_NULL);        /* Null password */
  643. X
  644. X    mesg[0] = 0;
  645. X    for (checkfunc = checkprocs; *checkfunc; checkfunc++) {
  646. X        if ((rcode = (*checkfunc)(password, userid, mesg)) != PWCK_OK)
  647. X            return(rcode);
  648. X    }
  649. X    return(PWCK_OK);
  650. X}
  651. X/*    End checkpasswd.c */
  652. END_OF_FILE
  653. if test 3670 -ne `wc -c <'checkpasswd/checkpasswd.c'`; then
  654.     echo shar: \"'checkpasswd/checkpasswd.c'\" unpacked with wrong size!
  655. fi
  656. # end of 'checkpasswd/checkpasswd.c'
  657. fi
  658. if test -f 'checkpasswd/checkpasswd.cf' -a "${1}" != "-c" ; then 
  659.   echo shar: Will not clobber existing file \"'checkpasswd/checkpasswd.cf'\"
  660. else
  661. echo shar: Extracting \"'checkpasswd/checkpasswd.cf'\" \(626 characters\)
  662. sed "s/^X//" >'checkpasswd/checkpasswd.cf' <<'END_OF_FILE'
  663. X#
  664. X# checkpasswd configuration file
  665. X# 
  666. X#    @(#)checkpasswd.cf    1.1 5/18/89 (cc.utexas.edu)
  667. X#
  668. X# dictionary -  Specify dictionary to look in.
  669. X#     There may be multiple such entries.
  670. X# dictionary    /path/to/dictionary    [description]
  671. Xdictionary    sysdict
  672. X
  673. X# singlecase    yes | [no]    - Pass single-case passwords
  674. X# singlecase    yes
  675. X
  676. X# minlength    N [5]    - Minimum password length
  677. X# minlength    6
  678. X
  679. X# maxlength    N [8]    Maximum effective password length
  680. X#            (for warning purposes only)
  681. X
  682. X# printonly    yes | [no]     - Allow only printable characters
  683. X
  684. X# badchars    "<string>"    - Replace illegal character list
  685. X# badchars    +"<string>"    - Add to illegal character list
  686. END_OF_FILE
  687. if test 626 -ne `wc -c <'checkpasswd/checkpasswd.cf'`; then
  688.     echo shar: \"'checkpasswd/checkpasswd.cf'\" unpacked with wrong size!
  689. fi
  690. # end of 'checkpasswd/checkpasswd.cf'
  691. fi
  692. if test -f 'checkpasswd/checkpasswd.h' -a "${1}" != "-c" ; then 
  693.   echo shar: Will not clobber existing file \"'checkpasswd/checkpasswd.h'\"
  694. else
  695. echo shar: Extracting \"'checkpasswd/checkpasswd.h'\" \(3267 characters\)
  696. sed "s/^X//" >'checkpasswd/checkpasswd.h' <<'END_OF_FILE'
  697. X
  698. X/* --------------------------------------------------------------------  */
  699. X/*                                                                       */
  700. X/*                         Author: Clyde Hoover                          */
  701. X/*                          Computation Center                           */
  702. X/*                   The University of Texas at Austin                   */
  703. X/*                          Austin, Texas 78712                          */
  704. X/*                         clyde@emx.utexas.edu                          */
  705. X/*                   uunet!cs.utexas.edu!ut-emx!clyde                    */
  706. X/*                                                                       */
  707. X/*This code may be distributed freely, provided this notice is retained. */
  708. X/*                                                                       */
  709. X/* --------------------------------------------------------------------  */
  710. X/*
  711. X *    checkpasswd.h - Master include for checkpasswd
  712. X * 
  713. X *    @(#)checkpasswd.h    1.4 11/26/90 (cc.utexas.edu) /tmp_mnt/usr/share/src/private/ut/share/bin/passwd/checkpasswd/SCCS/s.checkpasswd.h
  714. X */
  715. X
  716. X#include <stdio.h>
  717. X#include <ctype.h>
  718. X#ifdef    SYSV
  719. X#include <string.h>
  720. X#define index strchr
  721. X#else
  722. X#include <strings.h>
  723. X#endif
  724. X
  725. X/*
  726. X *    Return codes from checkpasswd() and pwck_*
  727. X *    Also used as exit codes from main()
  728. X */
  729. X#define    PWCK_FAIL    -1    /* Failure during check process */
  730. X#define    PWCK_OK        0    /* Password is ok to use */
  731. X#define    PWCK_NULL    1     /* Password is the null string */
  732. X#define    PWCK_OBVIOUS    2    /* Password is 'too obvious' */
  733. X#define    PWCK_FINGER    3    /* Password is part of users finger info */
  734. X#define    PWCK_INDICT    4    /* Password found in a dictionary */
  735. X#define    PWCK_ILLCHAR    5    /* Illegal character in password */
  736. X#define    PWCK_SHORT    6    /* Password too short */
  737. X
  738. X/*
  739. X *    Dictionary info
  740. X */
  741. Xtypedef struct _dict {
  742. X    char    *dict_path,        /* Path to dictionary */
  743. X        *dict_desc;        /* Descriptive phrase */
  744. X    struct _dict  *dict_next;    /* Link to next dict */
  745. X} dictionary;
  746. Xextern dictionary    *dictionaries; /* List of dictionaries to check */
  747. X
  748. X/*
  749. X *    This is the default dicitonary to look in
  750. X *    If you have some DBM dictionaries, either repoint this
  751. X *    define or comment it out and place dictionaries in
  752. X *    the configuration file.
  753. X */
  754. X#define    DEFAULT_DICT    "/usr/dict/words"    /* Default dictionary */
  755. X
  756. X#ifndef    CONFIG_FILE
  757. X            /* Set configuration file name */
  758. X# ifdef    DEBUG
  759. X#    define    CONFIG_FILE    "checkpasswd.cf" 
  760. X# else
  761. X#    define    CONFIG_FILE    "/usr/adm/checkpasswd.cf"
  762. X# endif    /* DEBUG */
  763. X#endif    /* CONFIG_FILE */
  764. X
  765. X/*
  766. X *    Password preferences
  767. X */
  768. Xint    single_case,        /* Single-case passwords ok or not */
  769. X    print_only,        /* Printable characters only */
  770. X    run_length,        /* Maximum length of character runs */
  771. X    min_length,        /* Minimum password length */
  772. X    max_length;        /* Maximum effective length */
  773. X
  774. X#define    sizeof_illegalcc    128
  775. Xextern char    illegalcc[];        /* Control characters not allowed */
  776. X
  777. X/*
  778. X *    Misc inline subroutine macros
  779. X */
  780. X
  781. X/*    Single string comparasion */
  782. X#define try(P,C,V) { \
  783. X    if (_cistrcmp((P),(C)) == 0) \
  784. X        return(V); \
  785. X    }
  786. X
  787. X/*    Multiple string comparasion */
  788. X#define mtry(P,C,V) { \
  789. X    int i; \
  790. X    if ((i = _instring((P),(C),(V))) != PWCK_OK) \
  791. X        return(i); \
  792. X}
  793. X
  794. X/* Compact string compare */
  795. X#define    streq(X,S)    (_cistrncmp((X),(S), strlen(X)) == 0)
  796. X
  797. X
  798. X/*    End checkpasswd.h    */
  799. END_OF_FILE
  800. if test 3267 -ne `wc -c <'checkpasswd/checkpasswd.h'`; then
  801.     echo shar: \"'checkpasswd/checkpasswd.h'\" unpacked with wrong size!
  802. fi
  803. # end of 'checkpasswd/checkpasswd.h'
  804. fi
  805. if test -f 'checkpasswd/dict/Makefile' -a "${1}" != "-c" ; then 
  806.   echo shar: Will not clobber existing file \"'checkpasswd/dict/Makefile'\"
  807. else
  808. echo shar: Extracting \"'checkpasswd/dict/Makefile'\" \(1552 characters\)
  809. sed "s/^X//" >'checkpasswd/dict/Makefile' <<'END_OF_FILE'
  810. X
  811. X# --------------------------------------------------------------------  #
  812. X#                                                                       #
  813. X#                         Author: Clyde Hoover                          #
  814. X#                          Computation Center                           #
  815. X#                   The University of Texas at Austin                   #
  816. X#                          Austin, Texas 78712                          #
  817. X#                         clyde@emx.utexas.edu                          #
  818. X#                   uunet!cs.utexas.edu!ut-emx!clyde                    #
  819. X#                                                                       #
  820. X#This code may be distributed freely, provided this notice is retained. #
  821. X#                                                                       #
  822. X# --------------------------------------------------------------------  #
  823. X#
  824. X#    Makefile for checkpasswd auxillary programs
  825. X#
  826. X#    @(#)Makefile    1.1 5/18/89 (cc.utexas.edu)
  827. X#
  828. XDEBUG    = -g -DDEBUG
  829. X# Change the line below to $(DEBUG)
  830. XCFLAGS    = -O
  831. X
  832. X# If building with MDBM, use these lines 
  833. X#ZLIB = ../mdbm/libmdbm.a
  834. X#ZFLAGS    = -DMDBM -I../mdbm $(ZLIB)
  835. X
  836. X# If building with NDBM, use these lines 
  837. XZLIB    =
  838. XZFLAGS    = -DNDBM
  839. X
  840. X
  841. Xall:    makedict viewdict
  842. X
  843. Xinstall::
  844. X    @echo No installation to be done
  845. X
  846. Xmakedict:    makedict.c $(ZLIB)
  847. X    $(CC) $(CFLAGS) -o makedict makedict.c $(ZFLAGS)
  848. X
  849. Xviewdict:    viewdict.c $(ZLIB)
  850. X    $(CC) $(CFLAGS) -o viewdict viewdict.c $(ZFLAGS)
  851. X
  852. Xclean::
  853. X    -rm -f *.o a.out core makedict viewdict
  854. X
  855. X../mdbm/libmdbm.a::
  856. X    (cd ../mdbm; make $(MFLAGS))
  857. END_OF_FILE
  858. if test 1552 -ne `wc -c <'checkpasswd/dict/Makefile'`; then
  859.     echo shar: \"'checkpasswd/dict/Makefile'\" unpacked with wrong size!
  860. fi
  861. # end of 'checkpasswd/dict/Makefile'
  862. fi
  863. if test -f 'checkpasswd/dict/README' -a "${1}" != "-c" ; then 
  864.   echo shar: Will not clobber existing file \"'checkpasswd/dict/README'\"
  865. else
  866. echo shar: Extracting \"'checkpasswd/dict/README'\" \(320 characters\)
  867. sed "s/^X//" >'checkpasswd/dict/README' <<'END_OF_FILE'
  868. XREADME for checkpasswd dictionary programs 4/25/89
  869. X
  870. XThe programs 'makedict' and 'viewdict' may be build to use either the
  871. X4.3BSD 'ndbm' routines or the 'mdbm' routines provided in ../mdbm
  872. X
  873. XEdit the Makefile to choose which option.  This option must match that
  874. Xchosen for 'view_dict.o' in ../Makefile (for checkpasswd).
  875. X
  876. END_OF_FILE
  877. if test 320 -ne `wc -c <'checkpasswd/dict/README'`; then
  878.     echo shar: \"'checkpasswd/dict/README'\" unpacked with wrong size!
  879. fi
  880. # end of 'checkpasswd/dict/README'
  881. fi
  882. if test -f 'checkpasswd/dict/makedict.8' -a "${1}" != "-c" ; then 
  883.   echo shar: Will not clobber existing file \"'checkpasswd/dict/makedict.8'\"
  884. else
  885. echo shar: Extracting \"'checkpasswd/dict/makedict.8'\" \(384 characters\)
  886. sed "s/^X//" >'checkpasswd/dict/makedict.8' <<'END_OF_FILE'
  887. X'\"
  888. X'\"    @(#)makedict.8    1.1 5/18/89 (cc.utexas.edu)
  889. X'\"
  890. X.TH MAKEDICT 1
  891. X.SH NAME
  892. Xmakedict \- Build DBM dictionary
  893. X.SH SYNOPSIS
  894. X.B makedict
  895. Xdbm_dictionary
  896. X.SH DESCRIPTION
  897. X.I Makedict
  898. Xreads the standard input and builds a DBM dictionary data base for use by
  899. X.IR checkpasswd (8).
  900. XIf
  901. X.I dbm_dictionary
  902. Xdoes not exist, it is created, else the data read is added to it.
  903. X.SH SEE ALSO
  904. Xviewdict
  905. END_OF_FILE
  906. if test 384 -ne `wc -c <'checkpasswd/dict/makedict.8'`; then
  907.     echo shar: \"'checkpasswd/dict/makedict.8'\" unpacked with wrong size!
  908. fi
  909. # end of 'checkpasswd/dict/makedict.8'
  910. fi
  911. if test -f 'checkpasswd/dict/makedict.c' -a "${1}" != "-c" ; then 
  912.   echo shar: Will not clobber existing file \"'checkpasswd/dict/makedict.c'\"
  913. else
  914. echo shar: Extracting \"'checkpasswd/dict/makedict.c'\" \(2606 characters\)
  915. sed "s/^X//" >'checkpasswd/dict/makedict.c' <<'END_OF_FILE'
  916. X
  917. X/* --------------------------------------------------------------------  */
  918. X/*                                                                       */
  919. X/*                         Author: Clyde Hoover                          */
  920. X/*                          Computation Center                           */
  921. X/*                   The University of Texas at Austin                   */
  922. X/*                          Austin, Texas 78712                          */
  923. X/*                         clyde@emx.utexas.edu                          */
  924. X/*                   uunet!cs.utexas.edu!ut-emx!clyde                    */
  925. X/*                                                                       */
  926. X/*This code may be distributed freely, provided this notice is retained. */
  927. X/*                                                                       */
  928. X/* --------------------------------------------------------------------  */
  929. X/*
  930. X *    makedict - Make DBM version of password dictionary
  931. X */
  932. X
  933. X#ifndef lint
  934. Xstatic char sccsid[] = "@(#)makedict.c    1.2 10/4/89 (cc.utexas.edu) /usr/src/ut/bin/passwd/checkpasswd/dict/SCCS/s.makedict.c";
  935. X#endif
  936. X
  937. X#ifdef  MDBM
  938. X#include "mdbm.h"
  939. X#define DBM        struct mdbm
  940. X#define DBM_CLOSE    mdbm_close
  941. X#endif
  942. X
  943. X#ifdef    NDBM
  944. X#include <ndbm.h>
  945. X#define DBM_CLOSE    dbm_close
  946. X#endif
  947. X
  948. X
  949. X/*
  950. X *    What cpp needs is a way for the programmer to issue an error
  951. X *    message here and abort compilation
  952. X */
  953. X#if    !defined(MDBM) && !defined(NDBM)
  954. X    "Either NDBM or MDBM must be defined"
  955. X#endif
  956. X
  957. X#include <sys/file.h>
  958. X#include <stdio.h>
  959. X
  960. Xchar    line[80];        /* Input buffer */
  961. X
  962. Xmain(argc, argv)
  963. Xint    argc;
  964. Xchar    *argv[];
  965. X{
  966. X    DBM    *dp;        /* Database pointer */
  967. X    int    recs = 0;    /* Record counter */
  968. X    datum    d,        /* Data datum */
  969. X        k;        /* Key datum */
  970. X#ifdef    SYSV
  971. X#define index strchr
  972. X#endif
  973. X    char    *index();
  974. X
  975. X    if (argc < 2) {
  976. X        printf("Usage: makedict dbm-file < input\n");
  977. X        exit(1);
  978. X    }
  979. X#ifdef    NDBM
  980. X    dp = dbm_open(argv[1], O_RDWR, 0);
  981. X    if (dp == 0) {
  982. X        if ((dp = dbm_open(argv[1], O_RDWR|O_CREAT, 0644)) == 0) {
  983. X            perror(argv[1]);
  984. X            exit(1);
  985. X        }
  986. X    }
  987. X#endif
  988. X#ifdef    MDBM
  989. X    dp = mdbm_open(argv[1], O_RDWR, (int *)0, (int *)0, (char *)0);
  990. X    if (dp == 0) {
  991. X        if ((dp = mdbm_open(argv[1], O_RDWR|O_CREAT, 0644,
  992. X             (int *)0, (int *)0, (char *)0)) == 0) {
  993. X            perror(argv[1]);
  994. X            exit(1);
  995. X        }
  996. X    }
  997. X#endif
  998. X    while (!feof(stdin)) {
  999. X        char    *p;
  1000. X
  1001. X        (void) fgets(line, sizeof(line), stdin);
  1002. X        if (p = index(line, '\n'))
  1003. X            *p = 0;
  1004. X        d.dptr = line;
  1005. X        d.dsize = strlen(line);
  1006. X#ifdef    MDBM
  1007. X        mdbm_store(dp, d, d, 1);
  1008. X#endif
  1009. X#ifdef    NDBM
  1010. X        dbm_store(dp, d, d, DBM_INSERT);
  1011. X#endif
  1012. X        recs++;
  1013. X    }
  1014. X    DBM_CLOSE(dp);
  1015. X    printf("%s built, %d records\n", argv[1], recs);
  1016. X}
  1017. END_OF_FILE
  1018. if test 2606 -ne `wc -c <'checkpasswd/dict/makedict.c'`; then
  1019.     echo shar: \"'checkpasswd/dict/makedict.c'\" unpacked with wrong size!
  1020. fi
  1021. # end of 'checkpasswd/dict/makedict.c'
  1022. fi
  1023. if test -f 'checkpasswd/dict/viewdict.8' -a "${1}" != "-c" ; then 
  1024.   echo shar: Will not clobber existing file \"'checkpasswd/dict/viewdict.8'\"
  1025. else
  1026. echo shar: Extracting \"'checkpasswd/dict/viewdict.8'\" \(350 characters\)
  1027. sed "s/^X//" >'checkpasswd/dict/viewdict.8' <<'END_OF_FILE'
  1028. X'\"
  1029. X'\"    @(#)viewdict.8    1.1 5/18/89 (cc.utexas.edu) /home/emx/u2/cc/clyde/src/new/passwd/checkpasswd/dict/SCCS/s.viewdict.8
  1030. X'\"
  1031. X.TH VIEWDICT 1
  1032. X.SH NAME
  1033. Xviewdict \- View DBM dictionary
  1034. X.SH SYNOPSIS
  1035. X.B viewdict
  1036. Xdbm_dictionary
  1037. X.SH DESCRIPTION
  1038. X.I Viewdict
  1039. Xreads a dictionary data base and prints its contents to the standard
  1040. Xoutput.
  1041. X.SH SEE ALSO
  1042. Xmakedict
  1043. END_OF_FILE
  1044. if test 350 -ne `wc -c <'checkpasswd/dict/viewdict.8'`; then
  1045.     echo shar: \"'checkpasswd/dict/viewdict.8'\" unpacked with wrong size!
  1046. fi
  1047. # end of 'checkpasswd/dict/viewdict.8'
  1048. fi
  1049. if test -f 'checkpasswd/dict/viewdict.c' -a "${1}" != "-c" ; then 
  1050.   echo shar: Will not clobber existing file \"'checkpasswd/dict/viewdict.c'\"
  1051. else
  1052. echo shar: Extracting \"'checkpasswd/dict/viewdict.c'\" \(2070 characters\)
  1053. sed "s/^X//" >'checkpasswd/dict/viewdict.c' <<'END_OF_FILE'
  1054. X
  1055. X/* --------------------------------------------------------------------  */
  1056. X/*                                                                       */
  1057. X/*                         Author: Clyde Hoover                          */
  1058. X/*                          Computation Center                           */
  1059. X/*                   The University of Texas at Austin                   */
  1060. X/*                          Austin, Texas 78712                          */
  1061. X/*                         clyde@emx.utexas.edu                          */
  1062. X/*                   uunet!cs.utexas.edu!ut-emx!clyde                    */
  1063. X/*                                                                       */
  1064. X/*This code may be distributed freely, provided this notice is retained. */
  1065. X/*                                                                       */
  1066. X/* --------------------------------------------------------------------  */
  1067. X/*
  1068. X *    viewdict - view DBM dictionary data base
  1069. X */
  1070. X#ifndef lint
  1071. Xstatic char sccsid[] = "@(#)viewdict.c    1.1 5/18/89 (cc.utexas.edu) /home/emx/u2/cc/clyde/src/new/passwd/checkpasswd/dict/SCCS/s.viewdict.c";
  1072. X#endif
  1073. X
  1074. X#ifdef  MDBM
  1075. X#include "mdbm.h"
  1076. X#define DBM        struct mdbm
  1077. X#endif
  1078. X
  1079. X#ifdef    NDBM
  1080. X#include <ndbm.h>
  1081. X#endif
  1082. X
  1083. X#if    !defined(MDBM) && !defined(NDBM)
  1084. X    "Either NDBM or MDBM must be defined"
  1085. X#endif
  1086. X
  1087. X#include <sys/file.h>
  1088. X#include <stdio.h>
  1089. X
  1090. Xmain(argc, argv)
  1091. Xint    argc;
  1092. Xchar    *argv[];
  1093. X{
  1094. X    DBM    *dp;        /* Database pointer */
  1095. X    datum    k;        /* Key datum */
  1096. X    char    t[128];        /* Output buffer */
  1097. X
  1098. X    if (argc < 2) {
  1099. X        printf("Usage: viewdict dbm-dictionary\n");
  1100. X        exit(1);
  1101. X    }
  1102. X#ifdef    NDBM
  1103. X    dp = dbm_open(argv[1], O_RDWR, 0);
  1104. X#endif
  1105. X#ifdef    MDBM
  1106. X    dp = mdbm_open(argv[1], O_RDONLY, 0, (int *)0, (int *)0, (char *)0);
  1107. X#endif
  1108. X    if (dp == 0) {
  1109. X        perror(argv[1]);
  1110. X        exit(1);
  1111. X    }
  1112. X/*     printf("Dictionary %s\n", argv[1]); */
  1113. X#ifdef    NDBM
  1114. X    for (k = dbm_firstkey(dp); k.dptr != 0; k = dbm_nextkey(dp)) {
  1115. X#endif
  1116. X#ifdef    MDBM
  1117. X    for (k = mdbm_firstkey(dp); k.dptr != 0; k = mdbm_nextkey(dp, k)) {
  1118. X#endif
  1119. X        (void) strncpy(t, k.dptr, k.dsize);
  1120. X        t[k.dsize] = 0;
  1121. X        printf("%s\n", t);
  1122. X    }
  1123. X    exit(0);
  1124. X}
  1125. END_OF_FILE
  1126. if test 2070 -ne `wc -c <'checkpasswd/dict/viewdict.c'`; then
  1127.     echo shar: \"'checkpasswd/dict/viewdict.c'\" unpacked with wrong size!
  1128. fi
  1129. # end of 'checkpasswd/dict/viewdict.c'
  1130. fi
  1131. if test -f 'checkpasswd/libmain.c' -a "${1}" != "-c" ; then 
  1132.   echo shar: Will not clobber existing file \"'checkpasswd/libmain.c'\"
  1133. else
  1134. echo shar: Extracting \"'checkpasswd/libmain.c'\" \(3482 characters\)
  1135. sed "s/^X//" >'checkpasswd/libmain.c' <<'END_OF_FILE'
  1136. X
  1137. X/* --------------------------------------------------------------------  */
  1138. X/*                                                                       */
  1139. X/*                         Author: Clyde Hoover                          */
  1140. X/*                          Computation Center                           */
  1141. X/*                   The University of Texas at Austin                   */
  1142. X/*                          Austin, Texas 78712                          */
  1143. X/*                         clyde@emx.utexas.edu                          */
  1144. X/*                   uunet!cs.utexas.edu!ut-emx!clyde                    */
  1145. X/*                                                                       */
  1146. X/*This code may be distributed freely, provided this notice is retained. */
  1147. X/*                                                                       */
  1148. X/* --------------------------------------------------------------------  */
  1149. X/*
  1150. X *    checkpasswd - Library version main routine
  1151. X *
  1152. X *    Compilation:    ld -r -o checkpasswd.o checkpasswd.o libmain.o
  1153. X *        pwck_dict.o pwck_passwd.o pwck_lexical.o pwck_local.o util.o 
  1154. X */
  1155. X#ifndef lint
  1156. Xstatic char sccsid[] = "@(#)libmain.c    1.2 11/14/89 (cc.utexas.edu)";
  1157. X#endif
  1158. X
  1159. X#include "checkpasswd.h"
  1160. X#include <varargs.h>
  1161. X
  1162. Xstatic char *replies[] = {
  1163. X    0,                    /* PWCK_OK */
  1164. X    "Empty password",            /* PWCK_NULL */
  1165. X    "This password is too easy to guess",    /* PWCK_OBVIOUS */
  1166. X    "This password is part of your 'finger' information", /* PWCK_FINGER */
  1167. X    "This password was found in a dictionary",    /* PWCK_INDICT */
  1168. X    "This password has an illegal character in it",    /* PWCK_ILLCHAR */
  1169. X    "This password is too short",            /* PWCK_SHORT */
  1170. X    0
  1171. X};
  1172. X#define    NREPLIES    7    /* Number of messages in replies */
  1173. X
  1174. Xstatic char    elucidate[BUFSIZ];    /* Expanded error message */
  1175. Xstatic char    *configfile = CONFIG_FILE;    /* Configuration file */
  1176. Xstatic char    configured = 0;        /* Has cf been read? */
  1177. Xstatic int    silent = 0;        /* Don't print messages */
  1178. X        returncode = 0;        /* Return PWCK return code */
  1179. Xint    standalone = 0;            /* Not a standalone application */
  1180. X
  1181. X/*
  1182. X *    setcheckpasswd - set parameters for checkpasswd
  1183. X *
  1184. X *    e.g setcheckpasswd("-c", <configfile>, "-e", "-s", 0);
  1185. X */
  1186. Xsetcheckpasswd(va_alist)
  1187. Xva_dcl        /* List of options */
  1188. X{
  1189. X    va_list    optlist;
  1190. X    char    *optx;
  1191. X
  1192. X    va_start(optlist);
  1193. X    while (optx = va_arg(optlist, char *)) {
  1194. X        if (*optx == '-') {
  1195. X            switch(*++optx) {
  1196. X            case 's':    /* -s (silent) */
  1197. X                silent = 1;
  1198. X                break;
  1199. X            case 'e':    /* -e (return error code) */
  1200. X                returncode = 1;
  1201. X                break;
  1202. X            case 'c':    /* -c config-file */
  1203. X                if (*++optx)
  1204. X                    configfile = optx;
  1205. X                else {
  1206. X                    optx = va_arg(optlist, char *);
  1207. X                    if (optx)
  1208. X                        configfile = optx;
  1209. X                }
  1210. X                break;
  1211. X            }
  1212. X        }
  1213. X    }
  1214. X    va_end(optlist);
  1215. X}
  1216. X
  1217. X/*
  1218. X *    checkpasswd - check password candidate
  1219. X *
  1220. X *    Returns 1 if <pwd> is ok to use as a password
  1221. X *        0 if not & an appropriate error message is issued
  1222. X */
  1223. Xcheckpasswd(uid, pwd)
  1224. Xint    uid;        /* User who wants this password */
  1225. Xchar    *pwd;        /* Password they want */
  1226. X{
  1227. X    int    rc;    /* Return code */
  1228. X
  1229. X#ifdef    DEBUG
  1230. X    printf("checkpasswd %d %s\n", uid, pwd);
  1231. X#endif
  1232. X    if (!configured) {
  1233. X        readconfig(configfile);
  1234. X        configured++;
  1235. X    }
  1236. X    rc = checkpassword(pwd, uid, elucidate);
  1237. X    if (rc == PWCK_OK)        /* Always silent on success */
  1238. X        return(returncode ? rc : 1);
  1239. X    if (silent)
  1240. X        return(returncode ? rc : 0);
  1241. X    if (rc <= NREPLIES) {
  1242. X        if (elucidate[0])
  1243. X            printf("%s.\n", elucidate);
  1244. X        else if (replies[rc])
  1245. X            printf("%s.\n", replies[rc]);
  1246. X        else
  1247. X            putchar('\n');
  1248. X    }
  1249. X    return(returncode ? rc : 0);
  1250. X}
  1251. X/*    End libmain.c */
  1252. END_OF_FILE
  1253. if test 3482 -ne `wc -c <'checkpasswd/libmain.c'`; then
  1254.     echo shar: \"'checkpasswd/libmain.c'\" unpacked with wrong size!
  1255. fi
  1256. # end of 'checkpasswd/libmain.c'
  1257. fi
  1258. if test -f 'checkpasswd/main.c' -a "${1}" != "-c" ; then 
  1259.   echo shar: Will not clobber existing file \"'checkpasswd/main.c'\"
  1260. else
  1261. echo shar: Extracting \"'checkpasswd/main.c'\" \(3839 characters\)
  1262. sed "s/^X//" >'checkpasswd/main.c' <<'END_OF_FILE'
  1263. X
  1264. X/* --------------------------------------------------------------------  */
  1265. X/*                                                                       */
  1266. X/*                         Author: Clyde Hoover                          */
  1267. X/*                          Computation Center                           */
  1268. X/*                   The University of Texas at Austin                   */
  1269. X/*                          Austin, Texas 78712                          */
  1270. X/*                         clyde@emx.utexas.edu                          */
  1271. X/*                   uunet!cs.utexas.edu!ut-emx!clyde                    */
  1272. X/*                                                                       */
  1273. X/*This code may be distributed freely, provided this notice is retained. */
  1274. X/*                                                                       */
  1275. X/* --------------------------------------------------------------------  */
  1276. X/*
  1277. X *    checkpasswd - Main program for standalone version
  1278. X *        libmain.c is the driver for the library version
  1279. X *
  1280. X *    Compilation:    cc -o checkpasswd checkpasswd.c main.c pwck_dict.c
  1281. X *            pwck_passwd.c pwck_lexical.c pwck_local.c util.c 
  1282. X */
  1283. X
  1284. X#ifndef lint
  1285. Xstatic char sccsid[] = "@(#)main.c    1.2 11/14/89 (cc.utexas.edu) /usr/src/ut/bin/passwd/checkpasswd/SCCS/s.main.c";
  1286. X#endif
  1287. X
  1288. X#include "checkpasswd.h"
  1289. X#include "version.h"
  1290. X
  1291. Xchar *replies[] = {
  1292. X    "This password is ok for use",        /* PWCK_OK */
  1293. X    "Empty password",            /* PWCK_NULL */
  1294. X    "This password is too easy to guess",    /* PWCK_OBVIOUS */
  1295. X    "This password is part of your 'finger' information", /* PWCK_FINGER */
  1296. X    "This password was found in a dictionary",    /* PWCK_INDICT */
  1297. X    "This password has an illegal character in it",    /* PWCK_ILLCHAR */
  1298. X    "This password is too short",            /* PWCK_SHORT */
  1299. X    0
  1300. X};
  1301. X#define    NREPLIES    7    /* Number of messages in replies */
  1302. X
  1303. Xchar    elucidate[BUFSIZ];    /* Expanded error message */
  1304. X
  1305. Xint    silent = 0,        /* Silent mode switch */
  1306. X    oneshot = 0,        /* Check only one password switch */
  1307. X    errornum = 0;        /* Print error number with message */
  1308. Xint    standalone = 1;        /* Running as standalone application */
  1309. X
  1310. Xmain(argc, argv)
  1311. Xint    argc;
  1312. Xchar    **argv;
  1313. X{
  1314. X    int    uid = getuid(),        /* Invoker's uid */
  1315. X        opt,            /* Argument parser */
  1316. X        interactive = 0;    /* In interactive mode? */
  1317. X    char    *configfile = CONFIG_FILE;    /* Configuration file */
  1318. X    extern char    *optarg;    /* From getopt() */
  1319. X
  1320. X    /* Process argument list */
  1321. X    while ((opt = getopt(argc, argv, "c:eosu:V?")) != EOF) {
  1322. X        switch (opt) {
  1323. X        case 'c':    /* -c config-file */
  1324. X            configfile = optarg;
  1325. X            break;
  1326. X        case 'e':    /* -e [print status number] */
  1327. X            errornum++;
  1328. X            break;
  1329. X        case 'o':    /* -o [check one password & quit] */
  1330. X            oneshot++;
  1331. X            break;
  1332. X        case 's':    /* -s [silent mode] */
  1333. X            silent++;
  1334. X            break;
  1335. X        case 'u':    /* -u [user id] */
  1336. X            if (uid == 0 && isdigit(*optarg))
  1337. X                uid = atoi(optarg);
  1338. X            break;
  1339. X        case 'V':    /* -V [print version information] */
  1340. X            printf("Version %s\nPatch level %s\n",
  1341. X                version, patchlevel);
  1342. X            break;
  1343. X        case '?':
  1344. X            printf("Usage: checkpasswd [-c config] [-e] [-o] [-s] [-V] [-u uid]\n");
  1345. X            exit(0);
  1346. X        }
  1347. X    }
  1348. X    (void) readconfig(configfile);
  1349. X    interactive = isatty(fileno(stdin));
  1350. X    for (;;) {
  1351. X        int    rc;    /* Return code from checkpasswd() */
  1352. X        char    ibuf[BUFSIZ];        /* Input buffer */
  1353. X        char    *nl;    /* Newline postition */
  1354. X
  1355. X        if (interactive) {
  1356. X            printf("Password to check: ");
  1357. X            fflush(stdout);
  1358. X        }
  1359. X        if (fgets(ibuf, sizeof(ibuf), stdin) == NULL)
  1360. X            break;
  1361. X        if (nl = index(ibuf, '\n'))
  1362. X            *nl = 0;
  1363. X        if (ibuf[0] == 0)
  1364. X            continue;
  1365. X        rc = checkpassword(ibuf, uid, elucidate);
  1366. X        if (!silent) {
  1367. X            if (errornum)
  1368. X                printf("%d ", rc);
  1369. X            if (rc <= NREPLIES) {
  1370. X                if (elucidate[0])
  1371. X                    printf("%s.\n", elucidate);
  1372. X                else if (replies[rc])
  1373. X                    printf("%s.\n", replies[rc]);
  1374. X                else
  1375. X                    putchar('\n');
  1376. X            }
  1377. X            else
  1378. X                printf("Error %d\n", rc);
  1379. X        }
  1380. X        if (oneshot)
  1381. X            exit(rc);
  1382. X    }
  1383. X    exit(0);
  1384. X}
  1385. X/*    End main.c */
  1386. END_OF_FILE
  1387. if test 3839 -ne `wc -c <'checkpasswd/main.c'`; then
  1388.     echo shar: \"'checkpasswd/main.c'\" unpacked with wrong size!
  1389. fi
  1390. # end of 'checkpasswd/main.c'
  1391. fi
  1392. if test -f 'checkpasswd/pwck_local.c' -a "${1}" != "-c" ; then 
  1393.   echo shar: Will not clobber existing file \"'checkpasswd/pwck_local.c'\"
  1394. else
  1395. echo shar: Extracting \"'checkpasswd/pwck_local.c'\" \(1637 characters\)
  1396. sed "s/^X//" >'checkpasswd/pwck_local.c' <<'END_OF_FILE'
  1397. X
  1398. X/* --------------------------------------------------------------------  */
  1399. X/*                                                                       */
  1400. X/*                         Author: Clyde Hoover                          */
  1401. X/*                          Computation Center                           */
  1402. X/*                   The University of Texas at Austin                   */
  1403. X/*                          Austin, Texas 78712                          */
  1404. X/*                         clyde@emx.utexas.edu                          */
  1405. X/*                   uunet!cs.utexas.edu!ut-emx!clyde                    */
  1406. X/*                                                                       */
  1407. X/*This code may be distributed freely, provided this notice is retained. */
  1408. X/*                                                                       */
  1409. X/* --------------------------------------------------------------------  */
  1410. X/*
  1411. X *    pwck_local - Perform 'local' password checks.
  1412. X *
  1413. X *    Returns:
  1414. X *        PWCK_OBVIOUS if <password> == hostname
  1415. X *        PWCK_OK if otherwise
  1416. X */
  1417. X#ifndef lint
  1418. Xstatic char sccsid[] = "@(#)pwck_local.c    1.1 5/18/89 (cc.utexas.edu)";
  1419. X#endif
  1420. X
  1421. X#include "checkpasswd.h"
  1422. X
  1423. Xpwck_local(password, userid, mesg)
  1424. Xchar    *password;    /* Password to check */
  1425. Xint    userid;        /* NOTUSED */
  1426. Xchar    *mesg;        /* Message buffer */
  1427. X{
  1428. X    char    myname[32];        /* Scratch */
  1429. X
  1430. X    (void) gethostname(myname, sizeof(myname));
  1431. X    try(password, myname, PWCK_OBVIOUS);
  1432. X    /*
  1433. X     * Could try full canoncalized hostname here in case gethostname
  1434. X     * didn't get that for us.
  1435. X     *
  1436. X     * Then look in users' .rhosts and try those strings (maybe)
  1437. X     */
  1438. X    return(PWCK_OK);
  1439. X}
  1440. X/*    End pwck_local.c */
  1441. END_OF_FILE
  1442. if test 1637 -ne `wc -c <'checkpasswd/pwck_local.c'`; then
  1443.     echo shar: \"'checkpasswd/pwck_local.c'\" unpacked with wrong size!
  1444. fi
  1445. # end of 'checkpasswd/pwck_local.c'
  1446. fi
  1447. if test -f 'checkpasswd/pwck_passwd.c' -a "${1}" != "-c" ; then 
  1448.   echo shar: Will not clobber existing file \"'checkpasswd/pwck_passwd.c'\"
  1449. else
  1450. echo shar: Extracting \"'checkpasswd/pwck_passwd.c'\" \(3284 characters\)
  1451. sed "s/^X//" >'checkpasswd/pwck_passwd.c' <<'END_OF_FILE'
  1452. X
  1453. X/* --------------------------------------------------------------------  */
  1454. X/*                                                                       */
  1455. X/*                         Author: Clyde Hoover                          */
  1456. X/*                          Computation Center                           */
  1457. X/*                   The University of Texas at Austin                   */
  1458. X/*                          Austin, Texas 78712                          */
  1459. X/*                         clyde@emx.utexas.edu                          */
  1460. X/*                   uunet!cs.utexas.edu!ut-emx!clyde                    */
  1461. X/*                                                                       */
  1462. X/*This code may be distributed freely, provided this notice is retained. */
  1463. X/*                                                                       */
  1464. X/* --------------------------------------------------------------------  */
  1465. X/*
  1466. X *    pwck_password - Check password candidate against the users' password
  1467. X *        file information, or any other information that is publicly
  1468. X *        available about this user that a bandit could use as
  1469. X *        password guesses.
  1470. X *
  1471. X *    This code has an option for the User Information Data Base used
  1472. X *    at the UT Computation Center.  Here is the place to search 
  1473. X *    any local 'finger' database.
  1474. X */
  1475. X#ifndef lint
  1476. Xstatic char sccsid[] = "@(#)pwck_passwd.c    1.2 6/5/89 (cc.utexas.edu)";
  1477. X#endif
  1478. X
  1479. X#include "checkpasswd.h"
  1480. X
  1481. X#ifdef    UTEXAS_CC
  1482. X/*
  1483. X *    For UTCC systems
  1484. X */
  1485. X#include <local/userinfo.h>
  1486. X#define    cname    pwp->ui_name
  1487. Xtypedef    userptr    pwptr;
  1488. X#define    setpwent    setuserent
  1489. X#define    getpwuid    getuserbyuid
  1490. X
  1491. X#else    /* UTEXAS_CC */
  1492. X
  1493. X#include    <pwd.h>
  1494. X#define    cname    pwp->pw_name
  1495. Xtypedef    struct passwd *pwptr;
  1496. X
  1497. X#endif    /* UTEXAS_CC */
  1498. X
  1499. Xpwck_passwd(password, userid, mesg)
  1500. Xchar    *password;
  1501. Xint    userid;
  1502. Xchar    *mesg;
  1503. X{
  1504. X    char    temp[BUFSIZ];    /* Scratch */
  1505. X    pwptr    pwp;        /* Pointer to user information */
  1506. X
  1507. X    mesg[0] = 0;
  1508. X#ifdef    DEBUG
  1509. X    printf("pwck_passwd: \"%s\"\n", password);
  1510. X#endif
  1511. X    if (userid < 0)            /* Can't do user checks */
  1512. X        return(PWCK_FAIL);
  1513. X
  1514. X    pwp = getpwuid(userid);
  1515. X    if (pwp == (pwptr )0)
  1516. X        return(PWCK_FAIL);
  1517. X
  1518. X    strcpy(mesg, "Password is part of your passwd information");
  1519. X    try(password, cname, PWCK_OBVIOUS);    /* Checks 'name' and 'Name' */
  1520. X
  1521. X    (void) strcpy(temp, cname);
  1522. X    (void) strcat(temp, cname);
  1523. X    try(password, temp, PWCK_OBVIOUS);    /* Check 'namename' */
  1524. X
  1525. X    (void) strcpy(temp, cname);
  1526. X    _flipstring(temp);
  1527. X    try(password, temp, PWCK_OBVIOUS);    /* 'eman' */
  1528. X
  1529. X#ifdef    UTEXAS_CC
  1530. X    /*
  1531. X     * Try the rest of the stuff in this userinfo record
  1532. X     */
  1533. X    try(password, pwp->ui_rje_cc, PWCK_OBVIOUS);
  1534. X    try(password, pwp->ui_bill_cc, PWCK_OBVIOUS);
  1535. X
  1536. X    mesg[0] = 0;
  1537. X    /* Try all 'finger' information */
  1538. X    mtry(password, pwp->ui_personal_name, PWCK_FINGER);
  1539. X    mtry(password, pwp->ui_nick_name, PWCK_FINGER);    
  1540. X    mtry(password, pwp->ui_home_address, PWCK_FINGER);
  1541. X    mtry(password, pwp->ui_work_address, PWCK_FINGER);
  1542. X    mtry(password, pwp->ui_home_phone, PWCK_FINGER);
  1543. X    mtry(password, pwp->ui_work_phone, PWCK_FINGER);
  1544. X    mtry(password, pwp->ui_birthday, PWCK_FINGER);
  1545. X    mtry(password, pwp->ui_project, PWCK_FINGER);
  1546. X    mtry(password, pwp->ui_fellows, PWCK_FINGER);
  1547. X#else
  1548. X    /*
  1549. X     * Try every word in user's GECOS entry
  1550. X     */
  1551. X    mesg[0] = 0;
  1552. X    mtry(password, pwp->pw_gecos, PWCK_FINGER);
  1553. X#endif
  1554. X    return(PWCK_OK);
  1555. X}
  1556. X/*    End pwck_passwd.c */
  1557. END_OF_FILE
  1558. if test 3284 -ne `wc -c <'checkpasswd/pwck_passwd.c'`; then
  1559.     echo shar: \"'checkpasswd/pwck_passwd.c'\" unpacked with wrong size!
  1560. fi
  1561. # end of 'checkpasswd/pwck_passwd.c'
  1562. fi
  1563. if test -f 'checkpasswd/version.h' -a "${1}" != "-c" ; then 
  1564.   echo shar: Will not clobber existing file \"'checkpasswd/version.h'\"
  1565. else
  1566. echo shar: Extracting \"'checkpasswd/version.h'\" \(1084 characters\)
  1567. sed "s/^X//" >'checkpasswd/version.h' <<'END_OF_FILE'
  1568. X
  1569. X/* --------------------------------------------------------------------  */
  1570. X/*                                                                       */
  1571. X/*                         Author: Clyde Hoover                          */
  1572. X/*                          Computation Center                           */
  1573. X/*                   The University of Texas at Austin                   */
  1574. X/*                          Austin, Texas 78712                          */
  1575. X/*                         clyde@emx.utexas.edu                          */
  1576. X/*                   uunet!cs.utexas.edu!ut-emx!clyde                    */
  1577. X/*                                                                       */
  1578. X/*This code may be distributed freely, provided this notice is retained. */
  1579. X/*                                                                       */
  1580. X/* --------------------------------------------------------------------  */
  1581. X/*
  1582. X *    checkpasswd version information
  1583. X *    @(#)version.h    1.1 5/18/89
  1584. X */
  1585. Xchar    *version = "checkpasswd 1.1 (5/12/89)\n",
  1586. X    *patchlevel = "2 (5/12/89)\n";
  1587. X
  1588. X/* End version.h */
  1589. END_OF_FILE
  1590. if test 1084 -ne `wc -c <'checkpasswd/version.h'`; then
  1591.     echo shar: \"'checkpasswd/version.h'\" unpacked with wrong size!
  1592. fi
  1593. # end of 'checkpasswd/version.h'
  1594. fi
  1595. if test -f 'npasswd.1' -a "${1}" != "-c" ; then 
  1596.   echo shar: Will not clobber existing file \"'npasswd.1'\"
  1597. else
  1598. echo shar: Extracting \"'npasswd.1'\" \(1764 characters\)
  1599. sed "s/^X//" >'npasswd.1' <<'END_OF_FILE'
  1600. X'\"
  1601. X'\"    @(#)npasswd.1    1.3 8/14/90 (cc.utexas.edu)
  1602. X'\"
  1603. X.TH NPASSWD 1
  1604. X.SH NAME
  1605. Xnpasswd \- change login password
  1606. X.SH SYNOPSIS
  1607. X.B npasswd
  1608. X[
  1609. X.B \-\^P
  1610. X] [
  1611. X.B \-\^V
  1612. X] [ username ]
  1613. X.SH DESCRIPTION
  1614. X.I Npasswd
  1615. Xchanges or installs a login password for
  1616. X.B username
  1617. X(your own by default).
  1618. XOnly the super-user can change another users' password.
  1619. X.PP
  1620. XWhen changing a password,
  1621. X.I npasswd
  1622. Xprompts for the old password and then for the new one.
  1623. XThe new password must be typed twice to forestall mistakes.
  1624. XThe new password is checked for reasonableness.
  1625. X.PP
  1626. X.I Npasswd
  1627. Xaccepts the option switches of the 4.3BSD and SunOS 4.X
  1628. X.I passwd
  1629. Xbut impliments none of them.
  1630. XThe
  1631. X.B \-\^V
  1632. Xoption prints version and patch level information.
  1633. X.PP
  1634. XThe
  1635. X.B \-\^P
  1636. Xoption indicates that 
  1637. X.B npasswd
  1638. Xwill be fed input from another program via a pipe.
  1639. XThis option is reserved for the super-user.
  1640. X.PP
  1641. X.I Npasswd
  1642. Xcan change both local passwords and passwords in a
  1643. XNetwork Information Service (aka Yellow Pages) database.
  1644. X.SH "THIS IS NOT A REAL MANUAL PAGE"
  1645. X\fB
  1646. XIt will probably be easier to adapt the manual page for
  1647. Xthe existing version of passwd installed.
  1648. XI have put much of the particulars about configuring npasswd into the help file.
  1649. X\fR
  1650. X.br
  1651. X.SH "SEE ALSO"
  1652. Xpasswd(1), passwd(5), yppasswd(3R), yppasswdd(8C),
  1653. Xfinger(1), login(1), crypt(3), passwd.adjuct(5), ypfiles(5), ypmake(8)
  1654. X.SH DIAGNOSTICS
  1655. XVarious, hopefully self-explanitory.
  1656. X.SH BUGS
  1657. XThis program could do shells and fullnames.
  1658. XProbably a future version will.
  1659. XSince it tries to work for a range of UNIX systems, it will without
  1660. Xdoubt not do everything quite as well as the vendor-supplied version.
  1661. X.SH AUTHOR
  1662. XClyde Hoover
  1663. X.br
  1664. XComputation Center
  1665. X.br
  1666. XThe University of Texas at Austin
  1667. X.br
  1668. Xclyde@emx.utexas.edu, uunet!cs.utexas.edu!ut-emx!clyde
  1669. END_OF_FILE
  1670. if test 1764 -ne `wc -c <'npasswd.1'`; then
  1671.     echo shar: \"'npasswd.1'\" unpacked with wrong size!
  1672. fi
  1673. # end of 'npasswd.1'
  1674. fi
  1675. if test -f 'npasswd.conf' -a "${1}" != "-c" ; then 
  1676.   echo shar: Will not clobber existing file \"'npasswd.conf'\"
  1677. else
  1678. echo shar: Extracting \"'npasswd.conf'\" \(551 characters\)
  1679. sed "s/^X//" >'npasswd.conf' <<'END_OF_FILE'
  1680. X#
  1681. X# npasswd configuration file
  1682. X#
  1683. X# dictionary -  Specify dictionary to look in.
  1684. X#     There may be multiple such entries.
  1685. X# dictionary    /path/to/dictionary    [description]
  1686. X
  1687. X# singlecase    yes | [no]    - Pass single-case passwords
  1688. X# singlecase    yes
  1689. X
  1690. X# minlength    N [5]    - Minimum password length
  1691. X# minlength    6
  1692. X
  1693. X# maxlength    N [8]    Maximum effective password length
  1694. X#            (for warning purposes only)
  1695. X
  1696. X# printonly    yes | [no]     - Allow only printable characters
  1697. X
  1698. X# badchars    "<string>"    - Replace illegal character list
  1699. X# badchars    +"<string>"    - Add to illegal character list
  1700. END_OF_FILE
  1701. if test 551 -ne `wc -c <'npasswd.conf'`; then
  1702.     echo shar: \"'npasswd.conf'\" unpacked with wrong size!
  1703. fi
  1704. # end of 'npasswd.conf'
  1705. fi
  1706. if test -f 'npasswd.help' -a "${1}" != "-c" ; then 
  1707.   echo shar: Will not clobber existing file \"'npasswd.help'\"
  1708. else
  1709. echo shar: Extracting \"'npasswd.help'\" \(695 characters\)
  1710. sed "s/^X//" >'npasswd.help' <<'END_OF_FILE'
  1711. X
  1712. XPasswd help file, version 1.1 of 9/21/89
  1713. X
  1714. XA UNIX system password should be at least 6 characters long and include 
  1715. Xat least one upper case letter (A-Z), digit (0-9) or punctuation character
  1716. X(such as   .   ,  or -  ).
  1717. X
  1718. XPasswords will NOT be accepted that:
  1719. X
  1720. X    * Are less than 6 characters long.
  1721. X
  1722. X    * Matches anything in your UNIX account information, such as your login
  1723. X      name or an item from your "finger" data entry.
  1724. X
  1725. X    * Are found in the system's spelling dictionary - unless it has some 
  1726. X      uppercase letters other than the first character.
  1727. X      For example, "Explain" would be rejected but "exPlain" would
  1728. X      be accepted.
  1729. X
  1730. X    * Have more than 3 repeated characters - thus "aaa" would be rejected.
  1731. END_OF_FILE
  1732. if test 695 -ne `wc -c <'npasswd.help'`; then
  1733.     echo shar: \"'npasswd.help'\" unpacked with wrong size!
  1734. fi
  1735. # end of 'npasswd.help'
  1736. fi
  1737. if test -f 'npasswd.motd' -a "${1}" != "-c" ; then 
  1738.   echo shar: Will not clobber existing file \"'npasswd.motd'\"
  1739. else
  1740. echo shar: Extracting \"'npasswd.motd'\" \(43 characters\)
  1741. sed "s/^X//" >'npasswd.motd' <<'END_OF_FILE'
  1742. XA local message can be put into this file.
  1743. END_OF_FILE
  1744. if test 43 -ne `wc -c <'npasswd.motd'`; then
  1745.     echo shar: \"'npasswd.motd'\" unpacked with wrong size!
  1746. fi
  1747. # end of 'npasswd.motd'
  1748. fi
  1749. if test -f 'npasswd.shar' -a "${1}" != "-c" ; then 
  1750.   echo shar: Will not clobber existing file \"'npasswd.shar'\"
  1751. else
  1752. echo shar: Extracting \"'npasswd.shar'\" \(1242 characters\)
  1753. sed "s/^X//" >'npasswd.shar' <<'END_OF_FILE'
  1754. X   File Name        Archive #    Description
  1755. X-----------------------------------------------------------
  1756. X CHANGE.LOG                 3    
  1757. X MANIFEST                   1    
  1758. X Makefile.dist              2    
  1759. X README                     1    
  1760. X checkpasswd/Makefile       1    
  1761. X checkpasswd/README         2    
  1762. X checkpasswd/call_ckpasswd.c  1    
  1763. X checkpasswd/checkpasswd.3  1    
  1764. X checkpasswd/checkpasswd.8  2    
  1765. X checkpasswd/checkpasswd.c  1    
  1766. X checkpasswd/checkpasswd.cf  1    
  1767. X checkpasswd/checkpasswd.h  1    
  1768. X checkpasswd/dict/Makefile  1    
  1769. X checkpasswd/dict/README    1    
  1770. X checkpasswd/dict/makedict.8  1    
  1771. X checkpasswd/dict/makedict.c  1    
  1772. X checkpasswd/dict/viewdict.8  1    
  1773. X checkpasswd/dict/viewdict.c  1    
  1774. X checkpasswd/libmain.c      1    
  1775. X checkpasswd/main.c         1    
  1776. X checkpasswd/pwck_dict.c    2    
  1777. X checkpasswd/pwck_lexical.c  2    
  1778. X checkpasswd/pwck_local.c   1    
  1779. X checkpasswd/pwck_passwd.c  1    
  1780. X checkpasswd/util.c         3    
  1781. X checkpasswd/version.h      1    
  1782. X npasswd.1                  1    
  1783. X npasswd.c                  3    
  1784. X npasswd.conf               1    
  1785. X npasswd.help               1    
  1786. X npasswd.motd               1    
  1787. X npasswd.shar               1    This shipping list
  1788. X pw_passwd.c                2    
  1789. X pw_userinfo.c              2    
  1790. X pw_yp.c                    3    
  1791. X version.h                  1    
  1792. END_OF_FILE
  1793. if test 1242 -ne `wc -c <'npasswd.shar'`; then
  1794.     echo shar: \"'npasswd.shar'\" unpacked with wrong size!
  1795. fi
  1796. # end of 'npasswd.shar'
  1797. fi
  1798. if test -f 'version.h' -a "${1}" != "-c" ; then 
  1799.   echo shar: Will not clobber existing file \"'version.h'\"
  1800. else
  1801. echo shar: Extracting \"'version.h'\" \(1076 characters\)
  1802. sed "s/^X//" >'version.h' <<'END_OF_FILE'
  1803. X
  1804. X/* --------------------------------------------------------------------  */
  1805. X/*                                                                       */
  1806. X/*                         Author: Clyde Hoover                          */
  1807. X/*                          Computation Center                           */
  1808. X/*                   The University of Texas at Austin                   */
  1809. X/*                          Austin, Texas 78712                          */
  1810. X/*                         clyde@emx.utexas.edu                          */
  1811. X/*                   uunet!cs.utexas.edu!ut-emx!clyde                    */
  1812. X/*                                                                       */
  1813. X/*This code may be distributed freely, provided this notice is retained. */
  1814. X/*                                                                       */
  1815. X/* --------------------------------------------------------------------  */
  1816. X/*
  1817. X *    npasswd version information
  1818. X *    @(#)version.h    1.6 version.h
  1819. X */
  1820. Xchar    *version = "npasswd 1.2 (03/19/90)",
  1821. X    *patchlevel = "2 (01/24/91)";
  1822. X
  1823. X/* End version.h */
  1824. END_OF_FILE
  1825. if test 1076 -ne `wc -c <'version.h'`; then
  1826.     echo shar: \"'version.h'\" unpacked with wrong size!
  1827. fi
  1828. # end of 'version.h'
  1829. fi
  1830. echo shar: End of archive 1 \(of 3\).
  1831. cp /dev/null ark1isdone
  1832. MISSING=""
  1833. for I in 1 2 3 ; do
  1834.     if test ! -f ark${I}isdone ; then
  1835.     MISSING="${MISSING} ${I}"
  1836.     fi
  1837. done
  1838. if test "${MISSING}" = "" ; then
  1839.     echo You have unpacked all 3 archives.
  1840.     rm -f ark[1-9]isdone
  1841. else
  1842.     echo You still need to unpack the following archives:
  1843.     echo "        " ${MISSING}
  1844. fi
  1845. ##  End of shell archive.
  1846. exit 0
  1847. -- 
  1848. Clyde Hoover (Shouter-To-Dead-Parrots)    |
  1849. UNIX/VMS Services            | "Any sufficently advanced technology 
  1850. Compuatation Center, UT Austin         | is indisguishable from a rigged demo."
  1851. clyde@emx.utexas.edu            |
  1852.  
  1853.